package com.bigger.arch.app.customer.controller;

import com.bigger.arch.app.customer.client.IHelloClient;
import com.bigger.arch.app.dto.UserDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/hello")
public class HelloController {

    @Autowired
    IHelloClient helloClient;

    @RequestMapping("/sayHello")
    public String sayHello(@RequestParam String name) {
        return helloClient.sayHello(name);
    }

    @RequestMapping(value = "/saveUser", method = RequestMethod.POST)
    public UserDto saveUser(@Valid UserDto userDto) {
        return helloClient.saveUser(userDto);
    }
}
